﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace EcSalseManage.EcSalse
{
    public partial class Project_getEmployeeDetail : System.Web.UI.Page
    {
        #region 页面初始化

        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.SetFocus(this.txtEmployeeCode);
            if (!Page.IsPostBack)
            {
                this.lbtnReset.Attributes.Add("OnClick", "form1.reset();return false");
                ViewState["Function"] = Request.QueryString["fun"].ToString();
            }
        }
        #endregion

        #region 查询
        protected void lbtnSearch_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            //wsKDHR.Service KDHR = new wsKDHR.Service();
            DataAccess.Operate.DA_Fin02_Inherit fin02DAL = new DataAccess.Operate.DA_Fin02_Inherit();

            ds = fin02DAL.GetEmployeeDetail(this.txtEmployeeCode.Text.Trim());
            dgList.DataSource = ds;
            dgList.DataBind();
        }
        #endregion

        #region DATAGRID操作
        protected void dgList_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                if (e.Item.ItemIndex > -1)
                {
                    string strJS = "";
                    ImageButton imgbtnSelect = (ImageButton)e.Item.FindControl("imgbtnSelect");

                    strJS = "window.opener." + ViewState["Function"].ToString() + "('" + e.Item.Cells[1].Text.ToString() + "','" +
                            e.Item.Cells[2].Text.ToString() + "');window.close();return false;";
                    imgbtnSelect.Attributes.Add("onclick", strJS);
                }
            }
        }
        #endregion
    }
}
